﻿/*
 * Copyright (c) 2010-2013 Ruben Chakhmakhchyan. All rights reserved.
 * 
 * This file contains Original Code and/or Modifications of Original Code
 * as defined in and that are subject to the Eclipse Public License
 * Version 1.0 (the 'License'). You may not use this file except in
 * compliance with the License. Please obtain a copy of the License at
 * http://opensource.org/licenses/EPL-1.0 and read it before using this file.
 */

#pragma once

#define PLUGIN_SUCCESS				0
#define PLUGIN_OK					PLUGIN_SUCCESS
#define PLUGIN_GENERAL_FAILURE		1

#define DRIVER_BASE				100
#define NET_BASE				200
#define SAVE_BASE				300


enum class ResultCode : int
{
    Success =					PLUGIN_OK,
    GeneralFailure =			PLUGIN_GENERAL_FAILURE,

    // image acquisition driver

    DriverGeneral = 			( DRIVER_BASE + 01 ),	// TWAIN general error
    DriverDsmLoadFailed	= 		( DRIVER_BASE + 10 ),	// DSM could not be loaded, ensure that it is installed
    DriverDsmOpenFailed	= 		( DRIVER_BASE + 11 ),	// DG_CONTROL / DAT_PARENT / MSG_OPENDSM - open DSM failed
    DriverDsmCloseFailed = 		( DRIVER_BASE + 12 ),	// DG_CONTROL / DAT_PARENT / MSG_OPENDSM - close DSM failed
    DriverDsmNotOpen = 			( DRIVER_BASE + 13 ),	// the DSM has not been opened, open it first
    DriverDsmEntry = 			( DRIVER_BASE + 14 ),	// DG_CONTROL / DAT_ENTRYPOINT / MSG_GET - failed getting entry points
    DriverDsmNotClosed =		( DRIVER_BASE + 15 ),	// the DSM is still open, close it first
    DriverDsGetInfo = 			( DRIVER_BASE + 20 ),	// failed to get the data source info
    DriverDsSelectCancel =		( DRIVER_BASE + 21 ),	// canceled data source selection
    DriverDsSelectFailed = 		( DRIVER_BASE + 21 ),	// failed to select the data source
    DriverDsOpen = 				( DRIVER_BASE + 22 ),	// failed to open data source
    DriverDsClose =				( DRIVER_BASE + 23 ),	// failed to close data source
    DriverCapGet = 				( DRIVER_BASE + 24 ),	// failed to get the capability
    DriverConnection =			( DRIVER_BASE + 25 ),	// driver is not connected

    // networking

    NetProtocol = 		( NET_BASE + 01 ),		// invalid network protocol
    NetPort = 			( NET_BASE + 02 ),		// invalid port
    NetUrl = 			( NET_BASE + 03 ),		// invalid url
    NetDnsResolve = 	( NET_BASE + 10 ),		// failed to resolve the domain
    NetConfigSession = 	( NET_BASE + 11 ),		// failed to configure the network session
    NetConnect = 		( NET_BASE + 12 ),		// failed connecting to server
    NetSend =			( NET_BASE + 20 ),		// data send failed
    NetReceive	=		( NET_BASE + 21 ),		// data receiving failed
    NetShutdown =		( NET_BASE + 30 ),		// could not shutdown the session

    SaveFileExists =			( SAVE_BASE + 1 ),		// file already exists
    SaveFileCreateFailed =		( SAVE_BASE + 2 ),		// file could not be created
    SaveStreamWriteFailed =		( SAVE_BASE + 3 ),		// writing to stream failed
    SavePathFailed =			( SAVE_BASE + 4 ),		// path could not be built
    SaveFileIO =				( SAVE_BASE + 5 ),		// save file io
};

#undef PLUGIN_SUCCESS
#undef PLUGIN_OK
#undef PLUGIN_GENERAL_FAILURE

#undef DRIVER_BASE
#undef NET_BASE
#undef SAVE_BASE
